home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / ctimer / ctimer1 / test.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-05  |  819 b   |  57 lines

  1. #include  "exec/types.h"
  2. #include  "exec/nodes.h"
  3. #include  "exec/ports.h"
  4. #include  "exec/io.h"
  5. #include  "exec/devices.h"
  6. #include  "exec/memory.h"
  7. #include  "devices/timer.h"
  8. #include  "dos.h"
  9.  
  10. #ifdef  stdout
  11. #undef  stdout
  12. #endif
  13.  
  14. BPTR  stdout = 0 ;
  15.  
  16. main(argc, argv)
  17. int   argc ;
  18. char  *argv[] ;
  19. {
  20.    int i, apples= 0 ;
  21.  
  22.   if (argc == 0)  stdout = (BPTR)Open ("CON:25/5/600/200/FTest", 1006) ;
  23.   
  24.   apples = 0 ;
  25.   Ctime(0) ;
  26.   for (i = 0 ; i < 2000000 ; ++i)
  27.     apples += 1 ;
  28.   Cend(0) ;
  29.  
  30.   Ctime(2) ;
  31.   Ctime(1) ;
  32.   Cend(1) ;
  33.   Cend(2) ;
  34.   
  35.   count_sheep() ;
  36.   
  37.   Creport() ;
  38.   Delay(400) ;
  39.   if (stdout)  Close (stdout) ;
  40. }
  41.  
  42.  
  43. count_sheep()
  44.   int i = 0,  j = 100 ;
  45.   
  46.   Ctime(3) ; 
  47.   while (i < 100)
  48.    {
  49.      if (i++ > --j)
  50.        { Cend(3) ;
  51.          return(0) ;
  52.        }   
  53.    }
  54.   Cend(3) ;
  55.   return(1) ;
  56. }